Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
eslint-import-resolver-node
Advanced tools
Node default behavior import resolution plugin for eslint-plugin-import.
The eslint-import-resolver-node package is a resolver for ESLint's import plugin that resolves node modules and paths. It is used to help ESLint understand the resolution of the import statements in a Node.js environment, ensuring that the paths to modules are correctly interpreted according to Node.js module resolution algorithms.
Resolve Node Modules
This feature allows ESLint to resolve import statements for Node modules, taking into account file extensions like .js, .jsx, .ts, and .tsx. The code sample shows how to configure the resolver in the ESLint configuration file.
module.exports = {
settings: {
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx']
}
}
}
};
Custom Module Directory
This feature allows the specification of custom module directories beyond the default 'node_modules'. In the code sample, 'src' is added as an additional directory to look for modules.
module.exports = {
settings: {
'import/resolver': {
node: {
moduleDirectory: ['node_modules', 'src']
}
}
}
};
This package extends ESLint's import resolution to webpack's module resolution. It is similar to eslint-import-resolver-node but specifically tailored for projects using webpack, where the module resolution can be more complex due to webpack's aliases and other features.
Similar to eslint-import-resolver-node, this package is designed to resolve TypeScript modules. It is particularly useful for projects written in TypeScript, as it understands TypeScript-specific paths and module resolution.
This resolver integrates with Babel's module resolver plugin. It is useful for projects that use Babel and have custom module resolution configured in their Babel settings, which might not be natively understood by ESLint.
Default Node-style module resolution plugin for eslint-plugin-import
.
Published separately to allow pegging to a specific version in case of breaking changes.
Config is passed directly through to resolve
as options:
settings:
import/resolver:
node:
extensions:
# if unset, default is just '.js', but it must be re-added explicitly if set
- .js
- .jsx
- .es6
- .coffee
paths:
# an array of absolute paths which will also be searched
# think NODE_PATH
- /usr/local/share/global_modules
# this is technically for identifying `node_modules` alternate names
moduleDirectory:
- node_modules # defaults to 'node_modules', but...
- bower_components
- project/src # can add a path segment here that will act like
# a source root, for in-project aliasing (i.e.
# `import MyStore from 'stores/my-store'`)
or to use the default options:
settings:
import/resolver: node
FAQs
Node default behavior import resolution plugin for eslint-plugin-import.
We found that eslint-import-resolver-node demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.